package com.moonstar.service.impl;

import com.moonstar.mapper.UserMapper;
import com.moonstar.pojo.User;
import com.moonstar.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class UserServiceImpl implements UserService {

//    @Autowired
//    private StringRedisTemplate stringRedisTemplate;

    @Autowired
    private UserMapper userMapper;

    @Override
    public User login(User user) {
        User one = userMapper.login(user.getUsername(), user.getPassword());
        return one;
    }

    @Override
    public User get(Long id) {
        return userMapper.get(id);
    }

    @Override
    public List<User> list(Map<String, Object> map) {
        return userMapper.list(map);
    }

    @Override
    public int count(Map<String, Object> map) {
        return userMapper.count(map);
    }

    @Override
    public int update(User user) {
        return userMapper.update(user);
    }

    @Override
    public int remove(Long id) {
        return userMapper.remove(id);
    }

    @Override
    public int save(User user) {
        return userMapper.save(user);
    }

    @Override
    public User getByUsername(String username) {
        return userMapper.getByUsername(username);
    }
}
